﻿<%@ Page Title="ScrumPeak.com" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
  AutoEventWireup="true" Inherits="MvcContrib.FluentHtml.ModelViewPage<IList<User>>" %>

<%@ Import Namespace="Peak.ApplicationServices" %>
<%@ Import Namespace="Peak.Web.Controllers" %>
<%@ Import Namespace="Peak.Web.Controllers.HtmlExtentions" %>
<%@ Import Namespace="Peak.Resources" %>
<%@ Import Namespace="Peak.Web.Controllers.Models" %>
<%@ Import Namespace="Peak.Web" %>
<%@ Import Namespace="Peak.Core" %>
<%@ Import Namespace="System.Threading" %>
<asp:Content ContentPlaceHolderID="center" runat="server">
  <div class="page-content">
    <div class="page-title">
      <%= PageTitles.TeamMembers %>
    </div>

    <script type="text/javascript">
      $(function() {
        setTableMultiSelect();
      });      
      
    </script>

    <form id="form" method="post">
    <%= Html.PeakButton<TeamController>(f=>f.Add(),Buttons.AddNew) %>
    <%= Html.PeakRemoveButton<TeamController>(f=>f.Remove(null),"form") %>
    <table class="table">
      <tr>
        <th class="autoWidthColumn">
        </th>
        <th align="left">
          <%= Columns.Name %>
        </th>
      </tr>
      <%
        foreach (User user in Model)
        {%>
      <tr>
        <td>
          <% if (user.UserName == Thread.CurrentPrincipal.Identity.Name)
             {%>
          <input type="checkbox" name="userIds" value="<%=user.Id%>" disabled="disabled" />
          <%
            }
             else
             {%>
          <input type="checkbox" name="userIds" value="<%=user.Id%>" />
          <%
            }%>
        </td>
        <td>
          <%= user.UserName %>
        </td>
      </tr>
      <%
        }%>
      <% if (ViewData.Model.Count == 0)
         {%>
      <tr>
        <td colspan="10">
          <%= Messages.NoResults%>
        </td>
      </tr>
      <% } %>
    </table>
    </form>
  </div>
</asp:Content>
